import launch
import os
import yaml
import launch_ros
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import Command, LaunchConfiguration
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    ld = LaunchDescription()
    sdkeli_config = os.path.join(get_package_share_directory('sdkeli_ls_udp2'),'config','sdkeli_lidar.yaml')
    with open(sdkeli_config,'r') as f:
        params = yaml.safe_load(f)["sdkeli_ls1207de"]["ros__parameters"]

    sdkeli_node = Node(
        package="sdkeli_ls_udp2",
        executable="sdkeli_ls1207de",
        parameters=[params],
        output='screen',
        # remappings=[("/scan","/keli_scan")]
      
    )


    ld.add_action(sdkeli_node)

    return ld